<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Menu Container</title>
<link type="text/css" rel="StyleSheet" href="/gdp/css/menu1.css" id="menuStyleSheet">
<script>
//***********************************************************************************
var ns=navigator.appName=="Netscape";//�Ƿ�Ϊnetscape
var ie=navigator.appName=="Microsoft Internet Explorer";//�Ƿ�Ϊinternet exporer
var mozillaVersion=parseFloat(navigator.appVersion);//Mozilla�汾��,��2.0,4.0,5.0
var nsVersion=0;
var ieVersion=0;
var ua=navigator.userAgent.toLowerCase();
if(ns){
  var nsIndex=ua.indexOf("netscape/");
  var tmpUa=ua.substring(nsIndex+9);
  nsVersion=parseFloat(tmpUa);
}
if(ie){
  var msieIndex=ua.indexOf("msie");
  var tmpUa=ua.substring(msieIndex+4);
  var msiedotIndex=tmpUa.indexOf(";");
  ieVersion=parseFloat(tmpUa.substring(0,msiedotIndex));
}
//***********************************************************************************
//alert(navigator.appName+"==ns"+ns+"==ie"+ie);



//���ΪNS,�����HTMLElement��insertAdjacentElement,insertAdjacentHTML,insertAdjacentText����,
//����С��IE�����
if(ns){
		//if(HTMLElement.prototype.insertAdjacentElement){
			HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode){
				//Ϊ�ṩ���ļ�����,��where����Ϊ��Сд�޹�.
				where=where.toLowerCase();
				switch (where){
				case 'beforebegin':
					this.parentNode.insertBefore(parsedNode,this)
					break;
				case 'afterbegin':
					this.insertBefore(parsedNode,this.firstChild);
					break;
				case 'beforeend':
					this.appendChild(parsedNode);
					break;
				case 'afterend':
					if (this.nextSibling) 
		                 this.parentNode.insertBefore(parsedNode,this.nextSibling);
					else this.parentNode.appendChild(parsedNode);
					break;
				}
			}
			HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr){
				var r = this.ownerDocument.createRange();
				r.setStartBefore(this);
				var parsedHTML = r.createContextualFragment(htmlStr);
				this.insertAdjacentElement(where,parsedHTML)
			}
			HTMLElement.prototype.insertAdjacentText = function(where,txtStr){
				var parsedText = document.createTextNode(txtStr)
				this.insertAdjacentElement(where,parsedText)
			}
		//}



}
</script>


<script type="text/javascript">
<!--

var menuBorderWidth = 2;

var tableMenu, objectMenu, openerDocument, openerWindow, currentSelected, activeSub, hideTimeoutHandle, tmpEl, tmpBound, hideAllSubsTimer;
var tmpArray = new Array();
var tmpCounter = 0;

var menuShowPause = 50;

function public_initiateMenu(tableEl, objectEl) {

	tableMenu = tableEl;
	objectMenu = objectEl;
	
	tableMenu.scriptlet = objectMenu;
	openerDocument = objectEl.document;
	openerWindow = openerDocument.parentWindow;

	if (openerWindow.document.all["menuStyleSheet"] != null){
		menuStyleSheet.href = openerWindow.menuStyleSheet.href;
	}
	
	document.body.innerHTML = tableEl.outerHTML;
	
	if (tableMenu.menuState == null){
		tableMenu.menuState = "visible";
	}
	if(objectMenu.style!=null){
		objectMenu.style.visibility = tableMenu.menuState;
	}
//	tableMenu.style.visibility = "hidden";	
	window.setTimeout("tableMenu.style.visibility='hidden'", 0);
	
	document.body.children[0].style.visibility = "visible";	
															
	window.title = openerWindow.title;
	if(openerWindow.menu_onComplete){
		openerWindow.menu_onComplete();
	}

}


function public_hideMenu() {
	hideAllSubs();
	objectMenu.style.visibility = "hidden";	
	
}

function isRow(el) {
	return el.tagName == "TR";
}

function isTable(el) {
	return el.tagName == "TABLE";
}

function overRow() {
    var el;
	if(ie){
	var fromEl = getParent(event.fromElement, isRow);
	var toEl = getParent(event.toElement, isRow);
	
	if (fromEl == toEl || toEl == null || toEl == currentSelected) return;
	 el = toEl;
   }
  if(ns){
	event=overRow.arguments[0];
	el = getParent(event.target, isRow);
	if(el==null) return;
  }
	hideAllSubs();
	//��ʾ�Ӳ˵�
	if (el.className == "sub") {
	   //alert("el.className"+el.getAttribute("menu"));

		if (el.getAttribute("menu") == null) {
			el.menu = el.all.tags("TABLE")[0];
		}
		else if (typeof(el.getAttribute("menu")) == "string") {
		    if(ie){
			   el.menu = openerWindow.document.all[el.getAttribute("menu")];
			}
			if(ns){
			  // alert(el.getAttribute("menu"));
			   el.menu = openerWindow.document.getElementById(el.getAttribute("menu"));
			   //alert(el.menu);

			}
		}
		openerWindow.showMenu(el.menu, new Boundaries(el), "horizontal", openerWindow.pauseBeforeShow);
		
		activeSub = el.menu;
		activeSub.menuItem = el;
		
		el.menu.menuState = "visible";
	}
	
	el.oldClassName = el.className;
	if (el.className == "disabled") {
		currentSelected = el;
		return;
	}
	el.className = "highlight";
	currentSelected = el;
	
	if (el.title != null && el.title != "")
		openerWindow.status = el.title;
	else if (el.href != null && el.href != "")
		openerWindow.status = el.href;
}

function outRow() {

if(ie){
	var fromEl = getParent(event.fromElement, isRow);
	var toEl = getParent(event.toElement, isRow);
	
	if (fromEl == toEl || fromEl == null) return;
			
	if ((fromEl.oldClassName == "sub" || fromEl.className == "sub") && toEl == null) {
		return;
	}
	else if (toEl == null) {
		currentSelected = null;
	}
	fromEl.className = fromEl.oldClassName;
	fromEl.oldClassName = null;
}

if(ns){
	event=outRow.arguments[0];
	el = getParent(event.target, isRow);
	if(el==null){
	  currentSelected = null;
	  return;
	}
	el.className = el.oldClassName;
	el.oldClassName = null;
}


	openerWindow.status = "";

}

function clickRow() {
    var el;
	if(ie){
	   el = getParent(event.srcElement, isRow);
    }
	if(ns){
		event=clickRow.arguments[0];
	   el = getParent(event.target, isRow);
	}
	if (el == null) return;
	if (el.getAttribute("havesub")!="1") {
	  //  alert("clickRow"+el.getAttribute("havesub")+":"+openerWindow.currentMenuItem);

		openerWindow.currentMenuItem.setId(el.getAttribute("menuid"));
		openerWindow.currentMenuItem.setIcon(el.getAttribute("icon"));
		openerWindow.currentMenuItem.setText(el.getAttribute("text"));
		
		//alert("el.target1");
		openerWindow.currentMenuItem.setAttributes((el.getAttribute("attributes")==null?"":el.getAttribute("attributes")));
		if(openerWindow.menu_onclick!=null){
			openerWindow.menu_onclick(openerWindow.currentMenuItem);
		}
		//alert("el.target");
		//if (el.target){
		//	openerWindow.open(el.href, el.target);
		//}else if (openerWindow.document.all.tags("BASE").item(0) != null){
			//alert(openerWindow.document.all.tags("BASE").item(0).target)
			//openerWindow.open(el.href, openerWindow.document.all.tags("BASE").item(0).target);
		//	eval("openerWindow."+el.href);
		//}else{
		//	openerWindow.location = el.href;
		//}

		openerWindow.hideAllMenuScriptlets();
	}
}

function getParent(el, f) {
	if (el == null) return null;
	else if (f(el)) return el;
	else{
	  if(ns){
	    return getParent(el.parentNode, f);
	  }
	  if(ie){
	    return getParent(el.parentElement, f);
	  }
	  //Ĭ��ΪIE
	    return getParent(el.parentElement, f);

	}
}


function hideAllSubs() {

	if (activeSub != null) {
		if (activeSub.scriptlet == null) {
			activeSub.menuState = "hidden";
		}
		else {
			if (activeSub.menuItem != null) {
				activeSub.menuItem.className = "sub";
				activeSub.menuItem.oldClassName = null;
				currentSelected = null;
				
				openerWindow.clearTimeout(openerWindow.showTimeoutHandle);
	
				if (activeSub.scriptlet != null) {
				//*********************************************************
				//���ι����,���netscape����������
				//���ǵ�ʹ��setTimeout����ʹ�ö༶�˵�����ʾ����bug,���ǽ�ֹʹ��setTimeout;

					if(ie){
						//tmpArray[tmpCounter] = activeSub.scriptlet;
						//window.setTimeout("tmpArray[" + (tmpCounter++) + "].hideMenu()", 0);
						activeSub.scriptlet.hideMenu();
                    }
					if(ns){
					    //tmpArray[tmpCounter] = activeSub.scriptlet.contentWindow;
						//window.setTimeout("tmpArray[" + (tmpCounter++) + "].public_hideMenu()", 0);
						activeSub.scriptlet.contentWindow.public_hideMenu();
					}
					activeSub = null;
				}
			}
		}
	}
}

function Boundaries(el) {
	this.left = objectMenu.offsetLeft + el.offsetLeft;
	this.top  = objectMenu.offsetTop + el.offsetTop;
	this.height = el.offsetHeight;
	this.width  = el.offsetWidth;
}

document.onmouseover = overRow;
document.onmouseout = outRow;
document.onclick = clickRow;

function myload(){
   if(ns){
      window.parent.initiateMenuNS(this);
   }
}


//-->
</script>

</head>
<body class="menuContainer" onload="myload();">



</body>
</html>

